#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableActivityDataDao:DaoBase<TableActivityData>
    {
        public override string GetFileName()
        {
            return "TableActivityData.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableActivityData>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableActivityData model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.typeId)) UnityEngine.Debug.LogError("数据表id重复:TableActivityData->id: " + model.typeId);
            #endif
            cachePrimaryInt[model.typeId] = model;
        }
        protected override TableActivityData ParseRowData(string[] rowData)
        {
            TableActivityData data = new TableActivityData();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.typeId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.name = string.Intern(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.rank = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.modelId = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.position = string.Intern(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.rotation = string.Intern(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.scale = float.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.sortType = int.Parse(rowData[7]);
            }
            return data;
        }
    }
}
